-
Notifications
You must be signed in to change notification settings - Fork 311
runtime: new vote cache types [wip] #5968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
}; | ||
typedef struct fd_vote_state_ele fd_vote_state_ele_t; | ||
|
||
#define POOL_NAME fd_vote_state_pool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not in the header
#define POOL_NEXT next_ | ||
#include "../../util/tmpl/fd_pool.c" | ||
|
||
#define MAP_NAME fd_vote_state_map |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not in the header
src/flamenco/stakes/fd_vote_states.h
Outdated
#define MAP_NEXT next_ | ||
#include "../../util/tmpl/fd_map_chain.c" | ||
|
||
struct fd_vote_states { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not in header
vote states uses to manage the vote states. */ | ||
|
||
fd_vote_state_ele_t * | ||
fd_vote_states_get_pool( fd_vote_states_t const * vote_states ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not in header?
fd_vote_states_get_pool( fd_vote_states_t const * vote_states ) { | ||
FD_SCRATCH_ALLOC_INIT( l, vote_states ); | ||
FD_SCRATCH_ALLOC_APPEND( l, fd_vote_states_align(), sizeof(fd_vote_states_t) ); | ||
uchar * pool = FD_SCRATCH_ALLOC_APPEND( l, fd_vote_states_align(), fd_vote_states_footprint( vote_states->max_vote_accounts ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't do this, save pointer or offset when you new
the structure
src/flamenco/stakes/fd_vote_states.c
Outdated
vote_states->magic = FD_VOTE_STATES_MAGIC; | ||
vote_states->max_vote_accounts = max_vote_accounts; | ||
|
||
if( FD_UNLIKELY( !fd_vote_state_pool_new( pool_mem, max_vote_accounts ) ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not like this, do
vote_states->pool = fd_vote_state_pool_join( fd_vote_state_pool_new( .. ) );
FD_TEST( vote_states->pool );
0cbba17
to
71757af
Compare
…-io/firedancer into ibhatt/new_vote_types
#define MAP_KEY_T fd_pubkey_t | ||
#define MAP_ELE_T fd_vote_state_ele_t | ||
#define MAP_KEY vote_account | ||
#define MAP_KEY_EQ(k0,k1) (!(memcmp( &(k0)->key,&(k1)->key,sizeof(fd_pubkey_t) ))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fd_pubkey_eq
No description provided.